﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SharpMUD.Framework.Net
{
    /// <summary>
    /// Defines the functionality of a simple network connection
    /// </summary>
    public interface INetworkConnection : IDisposable
    {
        /// <summary>
        /// Close the connection
        /// </summary>
        void Close();

        /// <summary>
        /// The current status of the network connection
        /// </summary>
        ConnectionStatus Status { get; }

        /// <summary>
        /// The time that this connection was accepted
        /// </summary>
        System.DateTime ConnectTime { get; }

        /// <summary>
        /// The local IP endpoint for the network connection
        /// </summary>
        System.Net.IPEndPoint LocalEndpoint { get; }
        /// <summary>
        /// The remote IP endpoint for the network connection
        /// </summary>
        System.Net.IPEndPoint RemoteEndpoint { get; }

        /// <summary>
        /// This event is raised if the network connection object has determined that
        /// the link was lost
        /// </summary>
        event ConnectionEventHandler LinkLost;
        /// <summary>
        /// This event is raised as soon as the network connection has been started to close
        /// </summary>
        event ConnectionEventHandler Closing;
        /// <summary>
        /// This event is raised as soon as the connection is accepted
        /// </summary>
        event ConnectionEventHandler Connected;
        /// <summary>
        /// This event is raised after the network connection has been disconnected
        /// </summary>
        event ConnectionEventHandler Disconnected;
    }
}
